package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.PersonInformationSettingIntegration;
import com.jwsoft.manager.common.vo.personInformationSetting.PersonInformationSettingVO;
import com.jwsoft.manager.common.vo.personInformationSetting.PersonInformationSettingKeyVO;
import com.jwsoft.manager.common.vo.personInformationSetting.PersonInformationSettingQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 个人信息授权设置网关
 *
 * @author chenzh
 * @since 2024-03-16
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "个人信息授权设置", description = "个人信息授权设置")
public class PersonInformationSettingController {

    @Autowired
    public PersonInformationSettingIntegration personInformationSettingIntegration;

    @Operation(summary = "个人信息授权设置分页查询",description = "个人信息授权设置分页查询")
    @PostMapping(value = "/personInformationSetting0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<PersonInformationSettingVO>> getList(@RequestBody @Validated PersonInformationSettingQueryVO vo) {
        return AppResponse.successData(personInformationSettingIntegration.getList(vo));
    }

    @Operation(summary = "个人信息授权设置根据主键查询详情",description = "个人信息授权设置根据主键查询详情")
    @PostMapping(value = "/personInformationSetting0002", produces = "application/json;charset=UTF-8")
    public AppResponse<PersonInformationSettingVO> getById(@RequestBody @Validated PersonInformationSettingKeyVO vo) {
        return AppResponse.successData(personInformationSettingIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "个人信息授权设置新增",description = "个人信息授权设置新增")
    @PostMapping(value = "/personInformationSetting0004", produces = "application/json;charset=UTF-8")
    public AppResponse<PersonInformationSettingVO> add(@RequestBody @Validated(value = {Validators.Add.class}) PersonInformationSettingVO vo) {
        return AppResponse.successData(personInformationSettingIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "个人信息授权设置修改",description = "个人信息授权设置修改")
    @PostMapping(value = "/personInformationSetting0005", produces = "application/json;charset=UTF-8")
    public AppResponse<PersonInformationSettingVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) PersonInformationSettingVO vo) {
        return AppResponse.successData(personInformationSettingIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "个人信息授权设置删除",description = "个人信息授权设置删除")
    @PostMapping(value = "/personInformationSetting0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated PersonInformationSettingKeyVO vo) {
        personInformationSettingIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
